Stratus HTTP API v1.5

Request

All request should be done to master node: http://master/

Response

All functions return response in JSON format.

Minimum response is:

{"error":"","code":200}

"error" - error message for user, if something wrong

"code" - code of current operation (described in "Response code" chapter)

Response code

200 Ok

400 Incorrect request

401 Unauthorized access

403 Forbidden

404 Method not found

500 Internal error

600 Password expired, only 'changePassword' function is available

Version

To get current HTTP API version

Request

GET /api/call/version

If you are receive "404 Not Found" then you should use old Stratus HTTP API documentation.

Response

Content-Type: application/json

{"api":1.5,"error":"","code":200}

CSRF check

From version 1.4

To every GET, POST request you should add "X-token" header which is in every response cookie "token". First token, to access all other functions in system, you can get from getLoginInfo function, which does not require "X-token" header.

Object management

Get object configuration

Request

GET /api/call/getAttributes

Response

200
Content-Type: application/json
{"list":{"ARCHSTATE":"off","NAME":"some name"},"type":"camera","error":"","code":200}

Parameters:

obj Required, Integer, object id

Get object list

Request

GET /api/call/getObjectList

examples:

Get list of roles for current user:
GET /api/call/getObjectList?type=role

Get list of sets in role:
GET /api/call/getObjectList?type=set&roleid=31

Get list of objects in set:
GET /api/call/getObjectList?setid=14

Response

200
Content-Type: application/json
{"list":[{"obj":"102","udid":"DC102","name":"Axis 241S","description":"","location":"","otype":"D","subtype":"C","protected":"0","permission":"MM","credentials":"LVvApaeDMrCSPsmxLVvApaeDMrCSPsmx","attributes":{"DEVICETYPE":"CAMERA","DEVID":"102","OBJID":"102","STATUS":"ON"}},{"obj":"109","udid":"DC109","name":"Axis Q7404","description":"","location":"","otype":"D","subtype":"C","protected":"0","permission":"MM","credentials":"LVvApaeDMrCSPsmxLVvApaeDMrCSPsmx","attributes":{"DEVICETYPE":"CAMERA","DEVID":"102","OBJID":"102","STATUS":"ON"}}],"error":"","code":200}

Parameters:

parentObj Optional, int|null, filter by parent obj id

childObj Optional, ,

type Optional, String, type of objects in list. Supported types are: camera, audio, node, role, set, user

withAttributes Optional, Boolean, If "true", then object list will be returned with attributes list

withBlocks Optional, Boolean, return with blocks

withCredentials Optional, Boolean, return with credentials, only for set

objList Optional, Array JSON, filter by obj id

setid Optional, int|null, filter by set id

roleid Optional, int|null, filter by role id

userid Optional, int|null, filter by user id

nodeid Optional, int|null, filter by node id

isAll Optional, Boolean, return all objects with type user, role or set without filtering based on credentials management

filterAttributeList Optional, Array JSON, if withAttributes=true then return only attributes from list

filterAttribute Optional, String, Name of filtered attribute. May be used in pair with $filterMask

filterMask Optional, String, Mask of filtered attribute value. May be used in pair with $filterAttribute

Get video url authorization information

Request

GET /api/call/authorizationManager

Response

200
Content-Type: application/json
{"result":{"authid":"c99dbbab890856416159524013565b653023","url":"rtsp:\/\/192.168.0.117:8554\/xmedia?dev=102&objid=102","param":{"MEDIATRANSPORT":"tcp","DEVICETYPE":"C","TIMEZONE":"UTC","FRAMERATE":"4","PIXELASPECT_RATIO":"auto","POSITIONCTL":"Axis"}},"error":"","code":200}

Parameters:

objid Required, Integer, camera object id

streamtype Required, String, type of stream, can be 'live', 'archive', 'snapshot'

player Optional, ,

analytics Optional, ,

Get camera downtime

Request

GET /api/call/getCameraDowntime

Response

200
Content-Type: application/json
{"error": "","code":200,"list":{"101":{"downtime":250,"details":[{"start":1411060120,"end":1411060150,"status":3},{"start":1411060200,"end":1411060420,"status":2}]},"101" : {"downtime":12,"details":[{"start":1411061218,"end":1411061230,"status":1 }] } }}

Parameters:

objList Required, Array JSON, list of obj id's

startTime Required, Integer, Unix timestamp in seconds

endTime Required, Integer, Unix timestamp in seconds

status Optional, int|null, Camera status to filter by (0 - on, 1 - off, 2 - off by schedule, 3 - broken)

details Optional, Boolean, If "true" all downtime intervals for specified period will be returned, otherwise only total downtime duration

Get camera downtime summarized by status with specified granularity

Request

GET /api/call/getCameraDowntimeSummary

Response

200
Content-Type: application/json
{"list":{"101":{"1414882800":{"3":27}},"103":{"1414882800":{"3":47,"1":185}}},"error":"","code":200}

Parameters:

objList Required, Array JSON, list of obj id's

startTime Required, Integer, Unix timestamp in seconds

endTime Required, Integer, Unix timestamp in seconds

granularity Required, String, hour/day/month

Add object to Stratus

Request

POST /api/call/addObject

Response

200
Content-Type: application/json
{"error":"","obj":106,"code":200}

Parameters:

type Required, String, type of added object. Supported types are: camera

attributes Required, Array JSON, JSONobject list of default values for new created object

setid Optional, ,

nodeid Optional, ,

Delete object from Stratus

Request

POST /api/call/deleteObject

Response

200
Content-Type: application/json
{"error":"","code":200}

Parameters:

objList Required, Array JSON, list of obj id's for delete

Change object configuration

Request

POST /api/call/setAttributes

Response

200
Content-Type: application/json
{"error":"","code":200}

Parameters:

obj Required, Integer, object id

attributes Required, Array JSON, JSONobject list of attributes

Storage

Get storage usage

Request

GET /api/call/getStorageUsage

Response

200
Content-Type: application/json
{"list":{"106":{"storageUsage":"","unit":"MB\/hour"}},"error":"","code":200}

Parameters:

objList Required, Array JSON, list of objects ids

granularity Required, String, can be hour, day

Get total size and oldest date in media archive

Request

GET /api/call/getStorageUsageTotals

Response

200
Content-Type: application/json
{"list":{"106":{"totalStorageUsage":44793328,"oldestTime":1373241600}},"error":"","code":200}

Parameters:

objList Required, Array JSON, list of objects ids

Get space utilization day-by-day

Request

GET /api/call/getStorageUsageSpread

Response

200
Content-Type: application/json
{"list":{"106":[{"storageUsage":"26436","timestamp":1373241600},{"storageUsage":"13590072","timestamp":1373328000},{"storageUsage":"21695872","timestamp":1373414400},{"storageUsage":"9480948","timestamp":1373500800}]},"error":"","code":200}

Parameters:

objList Required, Array JSON, list of objects ids

Get storage coverage

Request

GET /api/call/getStorageCoverage

Response

200
Content-Type: application/json
{"list":{"119":{"1373029740":"100","1373029800":"100","1373029860":"100","1373029920":"100","1373029980":"100","1373030040":"100","1373030100":"100","1373030160":"100","1373030220":"100","1373030280":"100","1373030340":"100","1373030400":"100","1373030460":"100","1373030520":"63"}},"error":"","code":200}

Parameters:

objList Required, Array JSON, list of obj id's

startTime Required, Integer, Unix timestamp in seconds

endTime Required, Integer, Unix timestamp in seconds

granularity Required, String, min, hour, day

streamNumber Optional, Integer, 1 - full image, 0 - digest

System

Getting system status

Request

GET /api/call/getSystemStatus

Response

200
Content-Type: application/json
{"status":"CRITICAL","description":"CRITICAL: System in a CRITICAL state. See details for more information.","reasons":["Video Archive loss detected 1 minutes ago"],"error":"","code":200}
status can be: ONLINE, OFFLINE, STARTING, STOPPING, BROKEN, CRITICAL, ALERT
description - short description about status
reasons - list of reasons about status

Getting avatar status

from version 1.5

Request

GET /api/call/getAvatarStatus?obj=101

Response

200
Content-Type: application/json
{"status":"OFFLINE","description":"OFFLINE: The application is not running (OFFLINE state). Please contact your System Administrator.","error":"","code":200}
status can be: ONLINE, OFFLINE
description - short description about status

Parameters:

obj Required, ,

Get server time

Request

GET /api/call/getServerTime

Response

200
Content-Type: application/json
{"servertime":1373554305,"error":"","code":200}

Login

Get login information

Request

GET /api/call/getLoginInfo

Response

200
Content-Type: application/json
{"loginInfo":{"encryptionKey":"daa604a6799aeb543a595d812c7c8c018fb74e6c91d5cc2ace33d903153482fa","loginTTL":5},"error":"","code":200}

Close current session

Request

GET /api/call/logout

Response

200
Content-Type: application/json
{"error":"","code":200}

Get version information

Request

GET /api/call/version

Response

200
Content-Type: application/json
{"api":1.3,"error":"","code":200}

Login to system

Request

POST /api/call/login

Response

200
Content-Type: application/json
{"DEFAULT_ROLE":31,"parameters":{"token":"65bdb82c1ea1bbc2e5cb6f6932974ca909038fff4e7aa84c950048a269ef0e9c"},"error":"","code":200}

Parameters:

name Required, String, user name

credentials Required, String, sha512(${encryptionKey} + sha512(${password}) + ${encryptionKey})

password Optional, String, password for LDAP login (do not use for now)